Repository navigation
refactor(coordinator): isolate public network views and refresh state - #1018
Gajesh2007 wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Consolidated into #1056 for review and merge after #1094, #1095 and #1096. #1056 contains this branch's exact head ( |
Public network statistics, geography, earnings totals, traffic series and leaderboards currently share refresh state with the main API server. This change gives them one
api/network.Controller, with files named for each aggregation, privacy rule and refresh responsibility. The API server constructs the owner and binds the same four public routes.Stacked on #1006 (
refactor/coordinator-read-cache), which supplies the shared cache and refresh coalescing primitives.The controller owns the two stats refresh flights and the totals window map, including the single mutex that serializes earnings queries across every window. Narrow dependencies read the server's current store, fleet and shared cache. Stats and geography keep independent 30-second refresh loops; totals keep their one-minute loop and five-minute safety TTL. Query ordering, source timestamps, partial geography availability, privacy floors, pseudonym tables, response bytes, status codes and cancellation behavior are preserved.
Tests now live beside the network operations they exercise. The API still tests provider registration/catalog invalidation through real routes. A new route test verifies store, fleet and cache replacement after route registration; it also passes against the original source. Maintained navigation and code citations follow the new owners, including correcting the existing leaderboard TTL description to the five minutes used for every window in both implementations.
flowchart TD subgraph Before H[Four public GET routes] --> S[api.Server handlers] L[StartCacheRefreshers] --> R[Server refresh flights and totals query mutex] S --> R R --> Q[Store aggregates and live fleet] Q --> C[Shared read cache] C --> O[Same cached JSON, source age and privacy rules] Q --> E[Core failure: retain unexpired success or 503] G[Independent geography refresh] --> P[Available or unavailable sections] P --> O endflowchart TD subgraph After H[Same four public GET routes] --> W[api.Server route bindings] W --> S[network.Controller Stats, Totals, Series, Leaderboard] L[Server.StartCacheRefreshers] --> R[Controller owns flights and totals query mutex] S --> R R --> Q[Current Store and Fleet dependencies] Q --> C[Same shared readcache.Cache] C --> O[Same cached JSON, source age and privacy rules] Q --> E[Core failure: retain unexpired success or 503] G[Controller independent geography refresh] --> P[Same availability and privacy rules] P --> O endValidation: Go 1.25 production build; pinned golangci-lint 2.1.6 with zero issues; full API subtree race suite (1,589 top-level cases / 2,796 including subtests, API 225.760s); focused concurrency/freshness/privacy tests; original-source and current-route boundary regressions; all 280 documentation pages checked. The two existing opt-in skips are unchanged. All 1,611 prior test/benchmark/fuzz/example symbols remain, plus the new route test. Declaration checks cover all 32 moved operations, 3,719 retained functions, and 22 constants/types/aliases, with explicit dependency and fixture mappings. Independent source, fixture and documentation review is clean.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.